import 'dart:convert';
import 'package:crypto/crypto.dart';


class SignService{

  static getSign(json) {
    List attrKeys = json.keys.toList();
    /// 排序 ASCII 字符顺序进行升序排列
    attrKeys.sort();
    /// 拼接key value字符串
    String str = '';
    for(var i=0;i<attrKeys.length;i++) {
      str += '${attrKeys[i]}${json[attrKeys[i]]}';
    }
    /// MD5加密
    return md5.convert(utf8.encode(str)).toString();
  }
}